using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class LOCATIONInfo
    {
		#region Local Variable
		public enum Field
		{
			LOCATION,
			NAME
		}
		private String _LOCATION;
		private String _NAME;
		
		public String LOCATION{	get{ return _LOCATION;} set{_LOCATION = value;} }
		public String NAME{	get{ return _NAME;} set{_NAME = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public LOCATIONInfo()
		{
			_LOCATION = "";
			_NAME = "";
		}
		public LOCATIONInfo(
		String LOCATION,
		String NAME
		)
		{
			_LOCATION = LOCATION;
			_NAME = NAME;
		}
		public LOCATIONInfo(DataRow dr)
		{
			if (dr != null)
			{
				_LOCATION = dr[Field.LOCATION.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.LOCATION.ToString()]);
				_NAME = dr[Field.NAME.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NAME.ToString()]);
			}
		}
		public LOCATIONInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_LOCATION = dr[Field.LOCATION.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.LOCATION.ToString()]);
				_NAME = dr[Field.NAME.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NAME.ToString()]);
			}
		}
		public LOCATIONInfo(LOCATIONInfo objEntr)
		{			
			_LOCATION = objEntr.LOCATION;			
			_NAME = objEntr.NAME;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("LOCATION");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.LOCATION.ToString(), typeof(String)),
				new DataColumn(Field.NAME.ToString(), typeof(String))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.LOCATION.ToString()] = _LOCATION;
			row[Field.NAME.ToString()] = _NAME;
			return row;
		}
        #endregion InitTable
    }
}
